home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat España 19
/
macformat_19.iso
/
Shareware
/
Developers
/
NDS Osax v1.0d2
/
Sample NDS Osax script
< prev
Wrap
Text File
|
1996-05-17
|
3KB
|
89 lines
--This script asks for a username (you can use a password dialog osax to get the password)
--and then logs in to the NDS tree. Then you can easily tell the finder to open up
--some saved NDS object files to mount necessary volumes
property theuser : ""
property NDSErrorList : {-601, -669, -636, -666, -672, -682, -384, -381, -30631, -30547, ¬
-30546, -602}
property NDSErrors : {"Unrecognized Login Name.", ¬
"Incorrect Password", "Server is unreachable", ¬
"Incompatible DS Version", "No Access", "Auditing Failed", ¬
"This machine is already logged into NDS", "MacIPX is not installed!", ¬
"No preferred DS tree! Please pick one using the NetWare Client control panel.", ¬
"NetWare Client is not loaded!", ¬
"MacIPX is not configured!", ¬
"You must enter a non-empty Username."}
property TryAgain : "yes"
----------------------------------------------------------
on run
set TryAgain to "yes"
repeat
set TryAgain to ""
Login()
if TryAgain is "" then exit repeat
end repeat
end run
----------------------------------------------------------
on Login()
GetUsername()
set thepassword to "mypassword" --or use a password osax, such as the one from Carl Bell
-- at <ftp://ackmo.baylor.edu//pub/bell/GetPasswordOSAX.hqx>
DoLoginToNDS(theuser, thepassword)
end Login
----------------------------------------------------------
on GetErrorFromNumber(errNum)
if (errNum is not in NDSErrorList) then
return "Unknown Error # " & errNum as text
else
set i to 0
repeat (number of items in NDSErrorList) times
set i to i + 1
if (item i of NDSErrorList) = errNum then set errPosition to i
end repeat
--display dialog item errPosition of NDSErrors
return item errPosition of NDSErrors
end if
end GetErrorFromNumber
----------------------------------------------------------
on GetUsername()
--(*
display dialog "Welcome!
Enter your NDS login name:
" default answer theuser with icon 1000
set theuser to text returned of result
end GetUsername
----------------------------------------------------------
on DoLoginToNDS(NDSUser, NDSPassword)
set theError to 0
--Log in to NDS Tree
try
NDS_Login Username NDSUser Password NDSPassword
set theError to result
on error errMsg number errNum
set theError to errNum
end try
--Check for any errors and show something useful to the user, with option to try again
if (theError is not 0) then
set ErrString to GetErrorFromNumber(theError)
display dialog "CAFE Login Failed!
" & ErrString buttons {"Try again", "Cancel"} default button 1 with icon 1000
set TryAgain to text of result
end if
end DoLoginToNDS
----------------------------------------------------------